<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
	<title>Dynatree - HTML4 transitional</title>

	<script src="../jquery/jquery.js" type="text/javascript"></script>
	<script src="../jquery/jquery-ui.custom.js" type="text/javascript"></script>
	<script src="../jquery/jquery.cookie.js" type="text/javascript"></script>

	<link href="../src/skin/ui.dynatree.css" rel="stylesheet" type="text/css" id="skinSheet">
	<script src="../src/jquery.dynatree.js" type="text/javascript"></script>

<style type="text/css">
#tree ul.dynatree-container {
	overflow: scroll;
	position: relative;
	width: 200px;
	height: 250px;
}
#tree2 {
	position: absolute;
	top: 150px;
	left: 350px;
}
</style>

	<!-- Start_Exclude: This block is not part of the sample code -->
	<link href="prettify.css" rel="stylesheet">
	<script src="prettify.js" type="text/javascript"></script>
	<link href="sample.css" rel="stylesheet" type="text/css">
	<script src="sample.js" type="text/javascript"></script>
	<!-- End_Exclude -->

<script type="text/javascript"><!--
var data = [
	{"title": "Item 1"},
	{"title": "Folder 2", "isFolder": true, "key": "folder2", "expand": true,
		"children": [
			{"title": "Sub-item 2.1",
				"children": [
							{"title": "Sub-item 2.1.1",
								"children": [
											{"title": "Sub-item 2.1.1.1"},
											{"title": "Sub-item 2.1.2.2"},
											{"title": "Sub-item 2.1.1.3"},
											{"title": "Sub-item 2.1.2.4"}
										]
								},
							{"title": "Sub-item 2.1.2"},
							{"title": "Sub-item 2.1.3"},
							{"title": "Sub-item 2.1.4"}
						]
				},
			{"title": "Sub-item 2.2"},
			{"title": "Sub-item 2.3 (lazy)"}
		]
	},
	{"title": "Folder 3", "isFolder": true, "key": "folder3",
		"children": [
			{"title": "Sub-item 3.1",
				"children": [
							{"title": "Sub-item 3.1.1"},
							{"title": "Sub-item 3.1.2"},
							{"title": "Sub-item 3.1.3"},
							{"title": "Sub-item 3.1.4"}
						]
				},
			{"title": "Sub-item 3.2"},
			{"title": "Sub-item 3.3"},
			{"title": "Sub-item 3.4"}
		]
	},
	{"title": "Item 5"}
];
$(function(){
	// --- Initialize first Dynatree -------------------------------------------
	$("#tree").dynatree({
		children: data,
		onActivate: function(node) {
			$("#echoActive").text(node.data.title + "(" + node.data.key + ")");
		},
		onDeactivate: function(node) {
			$("#echoActive").text("-");
		},
		dnd: {
			onDragStart: function(node) {
				logMsg("tree.onDragStart(%o)", node);
				return true;
			},
			onDragStop: function(node) {
				logMsg("tree.onDragStop(%o)", node);
			},
			autoExpandMS: 1000,
			preventVoidMoves: true, // Prevent dropping nodes 'before self', etc.
			onDragEnter: function(node, sourceNode) {
				logMsg("tree.onDragEnter(%o, %o)", node, sourceNode);
				return true;
			},
			onDragOver: function(node, sourceNode, hitMode) {
				logMsg("tree.onDragOver(%o, %o, %o)", node, sourceNode, hitMode);
				if(node.isDescendantOf(sourceNode)){
					return false;
				}
			},
			onDrop: function(node, sourceNode, hitMode, ui, draggable) {
				logMsg("tree.onDrop(%o, %o, %s)", node, sourceNode, hitMode);
				sourceNode.move(node, hitMode);
			},
			onDragLeave: function(node, sourceNode) {
				logMsg("tree.onDragLeave(%o, %o)", node, sourceNode);
			}
		}
	});
	// --- Initialize second Dynatree ------------------------------------------
	$("#tree2").dynatree({
		children: data,
		onActivate: function(node) {
			$("#echoActive2").text(node.data.title + "(" + node.data.key + ")");
		},
		onDeactivate: function(node) {
			$("#echoActive2").text("-");
		},
		dnd: {
			onDragStart: function(node) {
				logMsg("tree.onDragStart(%o)", node);
				return true;
			},
			onDragStop: function(node) {
				logMsg("tree.onDragStop(%o)", node);
			},
			autoExpandMS: 1000,
			preventVoidMoves: true, // Prevent dropping nodes 'before self', etc.
			onDragEnter: function(node, sourceNode) {
				logMsg("tree.onDragEnter(%o, %o)", node, sourceNode);
				return true;
			},
			onDragOver: function(node, sourceNode, hitMode) {
				logMsg("tree.onDragOver(%o, %o, %o)", node, sourceNode, hitMode);
				if(node.isDescendantOf(sourceNode)){
					return false;
				}
			},
			onDrop: function(node, sourceNode, hitMode, ui, draggable) {
				logMsg("tree.onDrop(%o, %o, %s)", node, sourceNode, hitMode);
				sourceNode.move(node, hitMode);
			},
			onDragLeave: function(node, sourceNode) {
				logMsg("tree.onDragLeave(%o, %o)", node, sourceNode);
			}
		}
	});
	<!-- Start_Exclude: This block is not part of the sample code -->
	$("#skinCombo")
	.val(0) // set state to prevent caching
	.change(function(){
		var href = "../src/"
			+ $(this).val()
			+ "/ui.dynatree.css"
			+ "?reload=" + new Date().getTime();
		$("#skinSheet").attr("href", href);
	});
	<!-- End_Exclude -->
});
--></script>
</head>

<body class="example">
	<h1>DTD test: HTML4 transitional</h1>
	<p class="description">
		This sample uses the standard jQuery draggable and droppable.
	</p>
	<div>
		Skin:
		<select id="skinCombo" size="1">
			<option value="skin">Standard ('/skin/')</option>
			<option value="skin-vista">Vista ('/skin-vista/')</option>
		</select>
	</div>

	<div id="tree"> 1 </div>
	<div>Active node 1: <span id="echoActive">-</span></div>
	<hr>
	<div id="tree2"> 2 </div>
	<div>Active node 2: <span id="echoActive2">-</span></div>

	<!-- Start_Exclude: This block is not part of the sample code -->
	<hr>
	<p class="sample-links  no_code">
		<a class="hideInsideFS" href="http://dynatree.googlecode.com">jquery.dynatree.js project home</a>
		<a class="hideOutsideFS" href="#">Link to this page</a>
		<a class="hideInsideFS" href="samples.html">Example Browser</a>
		<a href="#" id="codeExample">View source code</a>
	</p>
	<pre id="sourceCode" class="prettyprint" style="display:none"></pre>
	<!-- End_Exclude -->
</body>
</html>
